define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_sharedList(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": {"sharetype": ['+
				'{"id": "001","name": "一键分享名_001"},'+
				'{"id": "002","name": "一键分享名_002"}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		};
		function get_data_sharedSubmit(result){
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": {"id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		//返回信息
		return {
			//分享类型列表
			shared_list: function(callback) {
				//post请求
				Http.post({
					method: 'member.sharetype.getlist',
				}, function(result) {
					//函数回调
					if(callback)
						callback(get_data_sharedList(result).result);

				}, function(e) {

				}, function() {

				});
			},
			shared_submit:function(sharetype,callback){
				Http.post({
					method:'member.sharetype.update',
					updataParams:{
						sharetype:sharetype
					}
				},function(result){
					if(callback)
					callback(get_data_sharedSubmit(result));
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Share", factory);
});